<div class="box-body">
    <form class="layui-form" action="{:url('system/jobs/save')}" method="post">
        <div class="layui-form-item">
            <label class="layui-form-label xrequired">审批模块</label>
            <div class="layui-input-block">
                <select name="flow_id" lay-search>
                    <option value="">请选择</option>
                    {foreach $module as $m}
                    <option {if isset($flow) && $flow.flow_id==$m.flow_id}selected{/if} value="{$m.flow_id}">{$m.name}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-col-xs10">
                <a class="layui-btn layui-bg-blue" id="add-flow">添加</a>
            </div>
        </div>
        <div class="layui-form-item">
            <ul class="layui-timeline job-flow">
                {if isset($flow)}
                {foreach $flow->settings as $s}
                <li class="layui-timeline-item">
                    <input type="hidden" name="settings_id[]" value="{$s.settings_id}"/>
                    <i class="layui-icon layui-timeline-axis layui-icon-vercode"></i>
                    <div class="layui-timeline-content layui-text layui-row">
                        <div class="layui-col-xs8">
                            <div class="layui-col-xs6">
                                <input type="text" class="layui-input flow-title" placeholder="审批组" autocomplete="off" name="name[]" value="{$s.name}">
                            </div>
                            <div class="layui-col-xs6">
                                <div class="more-xm-select" item="{$s.user_id}" name="select-admin" tips="审批人"></div>
                            </div>
                        </div>
                        <div class="layui-col-xs4">
                            <div class="layui-btn-group">
                                <a class="layui-btn layui-btn layui-bg-blue flow-up"><i class="layui-icon layui-icon-up"></i></a>
                                <a class="layui-btn layui-btn flow-down"><i class="layui-icon layui-icon-down"></i></a>
                                <a class="layui-btn layui-btn layui-bg-red flow-delete"><i class="layui-icon layui-icon-subtraction"></i></a>
                            </div>
                        </div>
                    </div>
                </li>
                {/foreach}
                {/if}
            </ul>
        </div>
        {if isset($flow)}
        <input type="hidden" name="old_flow_id" value="{$flow.flow_id}">
        {/if}
    </form>
</div>
<script type="text/javascript">
    $(".more-xm-select").each(function()
    {
        var item = $(this).attr("item")
        ids = item ? item.split(',') : [];
        renderSelect(this, null, ids);
    });
</script>